package top.jojoace.RequestParam_DTO_Validate.Controller;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import top.jojoace.RequestParam_DTO_Validate.dto.PasswordValidatorDTO;

@RestController
public class PasswordController {

    /**
     * 传递一个JSON到PasswordValidatorDTO
     * {
     *     "password1":"123",
     *     "password2":"123"
     * }
     * 并检验两次密码是否一致。
     */
    @GetMapping("/pass")
    private Object passwordValidated(@RequestBody @Validated PasswordValidatorDTO passDTO){
        return passDTO.getPassword1()+"_"+passDTO.getPassword2();
    }

}
